﻿<template>
  <!-- 首页商品  大图显示 -->
  <div class="mains">
    <div class="card2">
      <div class="priduct">
        <img class="img1" :src="info.big_piclink != '' ? $fnc.getImgUrl(info.big_piclink) : $fnc.getImgUrl(info.piclink)" />
        <div class="con">
          <p>{{info.title}}</p>
          <p>提货时间：{{timeIosFormat(new Date())}}</p>
          <div class="con1">
            <p class="noTop">
              <i>￥</i>
              <b>{{ info.price | toFix }}</b>
              <del v-if="info.market_price">￥{{ info.market_price }}</del>
            </p>
            <span>马上抢</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
  
  import {
    mapState
  } from "vuex";
  export default {
    name: "card2",
    data() {
      return {};
    },
    props: {
      info: {
        type: Object
      }
    },
    components: {},
    methods: {
      timeIosFormat(time) {
        // 时间格式化 2019-09-08
        let year = time.getFullYear();
        let month = time.getMonth() + 1;
        let day = time.getDate();
        if ((month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12) && day ==
          31) {
          return year + '-' + (month + 1) + '-' + 1;
        } else if ((month == 4 || month == 6 || month == 9 || month == 11) && day == 30) {
          return year + '-' + (month + 1) + '-' + 1;
        } else if (month == 2) {
          //判断是否是闰年
          if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) {
            if (month == 2 && day == 29) {
              return year + '-' + (month + 1) + '-' + 1;
            }
            return year + '-' + month + '-' + (day + 1);
          } else {
            if (month == 2 && day == 28) {
              return year + '-' + (month + 1) + '-' + 1;
            }
            return year + '-' + month + '-' + (day + 1);
          }

        } else {
          return year + '-' + month + '-' + (day + 1);
        }
      },
    },
    filters: {
      toFix(val) {
        return parseFloat(val).toFixed(2);
      }
    },
  };
</script>

<style lang="less" scoped>
.mains {
  width: 100%;
  height: 100%;
  overflow: auto;

  .priduct {
    width: 95%;
    margin: 10px 10px 0px 10px;
    background: rgb(255, 255, 255);
    border: 1px solid rgb(255, 255, 255);
    border-radius: 10px;

    .img1 {
      width: 100%;
      margin: 0 auto;
    }

    .con {
      padding: 0 5px 0 5px;

      p:nth-child(1) {
        margin-top: 10px;
        font-size: 16px;
        color: rgb(58, 58, 58);
        line-height: 22px;
      }

      p:nth-child(2) {
        color: rgb(255, 202, 80);
        font-size: 15px;
      }

      .con1 {
        width: 100%;
        display: flex;
        flex-wrap: nowrap;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 5px;
        > span {
          font-size: 12px;
          font-weight: bold;
          color: #ffffff;
          background-color: #ff3a63;
          background: -webkit-linear-gradient(
            to left,
            #ff3a63,
            #ff7d5e
          ); /* Safari 5.1 - 6.0 */
          background: -o-linear-gradient(
            to left,
            #ff3a63,
            #ff7d5e
          ); /* Opera 11.1 - 12.0 */
          background: -moz-linear-gradient(
            to left,
            #ff3a63,
            #ff7d5e
          ); /* Firefox 3.6 - 15 */
          background: linear-gradient(
            to left,
            #ff3a63,
            #ff7d5e
          ); /* 标准的语法 */
          border-radius: 10px;
          padding: 2px 15px;
          border-radius: 20px;
        }
        .noTop {
          margin-top: 0 !important;

          span {
            color: red;

            > b {
              font-size: 16px;
            }

            i:nth-of-type(1) {
              font-style: normal;
            }

            i:nth-of-type(2) {
              font-style: normal;
              font-size: 14px;
              font-weight: bold;
            }

            del {
              color: rgb(203, 203, 203);
              font-size: 15px;
              padding-left: 10px;
            }
          }
        }
      }
    }
  }

  .self {
    width: 95%;
    margin: 10px auto;
    background-color: rgb(255, 255, 255);
    border: 1px solid rgb(255, 255, 255);
    border-radius: 10px;

    .head {
      width: 100%;
      height: 35px;
      padding-left: 8px;
      padding-right: 8px;
      background-color: rgb(255, 131, 98);
      color: white;
      font-size: 15px;
      border-top-left-radius: 10px;
      border-top-right-radius: 10px;
      position: relative;
      display: flex;
      justify-content: space-between;
      align-items: center;

      span:nth-child(2) {
        font-size: 14px;
      }

      .tag {
        width: 20px;
        height: 20px;
        background-color: rgb(255, 131, 98);
        position: absolute;
        bottom: -3px;
        left: 50%;
        transform: translateX(-50%) rotate(45deg);
      }

      .arrow {
        padding-top: 10px;
        font-size: 12px;
      }
    }

    .button {
      display: flex;
      flex-direction: row;
      justify-content: space-between;
      margin-top: 5px;
      margin-bottom: 10px;

      .dianhua {
        padding-left: 40px;
      }

      .mendian {
        margin-right: 40px;
      }
    }

    .foot {
      margin-left: 6px;
      color: rgb(209, 209, 209);

      line-height: 17px;
      margin-bottom: 10px;

      span:nth-child(2) {
        font-size: 15px;
        margin-left: 5px;
      }
    }
  }

  .container {
    width: 100%;
    font-size: 14px;
    display: flex;
    align-items: center;
    flex-direction: row;
    margin-top: 15px;
    padding-left: 12px;

    > div:nth-child(1) {
      width: 57px;
      height: 52px;
      background: red;
      border-radius: 50%;
      overflow: hidden;

      > img {
        width: 100%;
        height: 100%;
      }
    }

    > div:nth-child(2) {
      width: 100%;
      padding-left: 15px;

      > p:nth-child(1) {
        display: flex;
        justify-content: space-between;
        font-weight: bold;

        > span:nth-child(1) {
          font-size: 15px;
          color: rgb(51, 51, 51);
        }

        > span:nth-child(2) {
          padding-right: 10px;
          color: rgb(255, 50, 50);
          font-weight: lighter;
          font-size: 14px;
        }
      }

      > p:nth-child(2) {
        color: rgb(168, 168, 166);
      }

      > p:nth-child(3) {
        color: rgb(51, 51, 51);
      }
    }
  }
}
</style>
